import React, { useEffect } from 'react';
//需求：第一次渲染完毕后，从服务器异步获取数据
export default function DemoTwo() {
  const queryData = () => {
    return new Promise((resolve) => {
      setTimeout(() => {
        resolve([10, 20, 30]);
      }, 1000);
    });
  };
  useEffect(() => {
    const next = async () => {
      let data = await queryData();
      console.log(data);
    };
    next();
  }, []);
  return <></>;
}
